﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Interfaces
{
    public class Transaction
    {
        public Transaction()
        {
            Tags = new List<string>();
        }

        public DateTime Date { get; set; }
        public PayMode PayMode { get; set; }
        public string Info { get; set; }
        public string PayeeName { get; set; }
        public string Memo { get; set; }
        public decimal Amount { get; set; }
        public string Category { get; set; }
        public List<string> Tags { get; set; }

        public string ToLine()
        {
            StringBuilder builder = new StringBuilder();
            builder.Append(Date.ToString("MM-dd-yy"));
            builder.Append(";");
            builder.Append((int)PayMode);
            builder.Append(";");
            builder.Append(Info);
            builder.Append(";");
            builder.Append(PayeeName);
            builder.Append(";");
            builder.Append(Memo);
            builder.Append(";");
            builder.Append(Amount);
            builder.Append(";");
            builder.Append(Category);
            builder.Append(";");
            foreach (string tag in Tags)
            {
                builder.Append(string.Format("{0} ", tag));
            }
            return builder.ToString();
        }
    }
}
